# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-kr-pretty
pkgver=0.2.1
pkgrel=1
pkgdesc='Pretty printing for Go values'
arch=('any')
url="https://github.com/kr/pretty"
license=('MIT')
depends=('go' 'golang-github-kr-text')
source=("$pkgname-$pkgver.tar.gz::https://github.com/kr/pretty/archive/v$pkgver.tar.gz")
sha512sums=('8f4a02171056d983bd67e964818fbfe705a0a549d2db43e9b3add2383c9191cc218449daaeba4b77228fb0cbdf6badcb0e75600e8b7c8dc3cddae1e0c4de83f0')

check() {
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/kr
  cp -a "$srcdir"/pretty-$pkgver "$srcdir"/build/src/github.com/kr/pretty
  cd "$srcdir"/build/src/github.com/kr/pretty
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/kr
  cp -a "$srcdir"/pretty-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/kr/pretty

  install -Dm644 pretty-$pkgver/License "$pkgdir"/usr/share/licenses/$pkgname/License
}
